﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using AsyncPersistence.Common;
using AsyncPersistence.Entities;
using AsyncPersistence.Services;

namespace AsyncPersistence.Common
{
    public abstract class APersistenceTask : ITask
    {
        protected PersistableEntity entity;
        protected IPersistenceService persistanceService;

        public APersistenceTask(PersistableEntity entity, IPersistenceService persistanceService)
        {
            this.entity = entity;
            this.persistanceService = persistanceService;
            RequestTime = DateTime.Now;
        }

        public DateTime RequestTime { get; private set; }

        public abstract void Execute();

        public long EntityId()
        {
            return entity.Id;
        }
    }
}
